/**
 * @author chenxing
 */
public class code_26 {
    public static int removeDuplicates(int[] nums) {
        int slow = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == nums[slow]) {
                continue;
            }
            slow++;
            nums[slow] = nums[i];
        }
        return slow + 1;
    }
}
